AVRO-2825: [csharp] Resolve: C# Logical Types throw exception on unknown#3727
Merged
RyanSkraba merged 10 commits intoapache:mainfrom May 10, 2026
Merged
AVRO-2825: [csharp] Resolve: C# Logical Types throw exception on unknown#3727RyanSkraba merged 10 commits intoapache:mainfrom
RyanSkraba merged 10 commits intoapache:mainfrom
Conversation
Contributor
Author
|
@zcsizmadia @KalleOlaviNiemitalo I have pushed a fix for the CodeQL warning last week. |
RyanSkraba
reviewed
May 6, 2026
| "profiles": { | ||
| "Avro.codegen": { | ||
| "commandName": "Project", | ||
| "commandLineArgs": " -s C:\\Users\\Thomas.Bruns\\source\\repos\\AzureDevOps\\TQL.Kafka.Samples\\TQL.Kafka.Samples\\TQL.Kafka.Samples.Messages\\v1\\cdc_tql_dbo_tbldrops.avsc .\\tab --namespace NO_SCHEMA_NAMESPACE:TQL.DEMO" |
Contributor
There was a problem hiding this comment.
This might have been a mistakenly added file 😄
Contributor
Author
There was a problem hiding this comment.
Good catch, @RyanSkraba! I inherited that file when I brought Tom's original branch over.
I have deleted it and pushed the update.
RyanSkraba
approved these changes
May 10, 2026
Contributor
RyanSkraba
pushed a commit
that referenced
this pull request
May 10, 2026
…own (#3727) * AVRO-2825: [csharp] Resolve: C# Logical Types throw exception on unknown logical type (cherry picked from commit ad61af0) * [AVRO-3941] CSharp Resolve missing namespace issue (cherry picked from commit e5a7ded) * Resolve requested changes on PR 2751 (cherry picked from commit 8909529) * uncomment testcase after testing (cherry picked from commit 235d329) * savepoint remove local setting files (cherry picked from commit f7b4872) * backout chags for a different pr, adjust unit test (cherry picked from commit 60463b5) * changes from code review (cherry picked from commit 42b0fbd) * Resolve remaining feedback for AVRO-2825 and fix complex logical type parsing * Fix CodeQL warning: Use pattern matching to assert logicalSchema type safely * Remove accidentally tracked launchSettings.json --------- Co-authored-by: Tom Bruns <TBruns@tql.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
This pull request resolves AVRO-2825 where the C# implementation threw a
SchemaParseExceptionorAvroTypeExceptionwhen encountering unrecognized Logical Types. This behavior was inconsistent with the Avro specification and the Java implementation, which should fall back to the underlying base type.This is a takeover of PR #2751. In addition to bringing the code up to date with the current
mainbranch, this PR addresses the following:LogicalSchema.NewInstancewhere logical types applied to flattened complex types (like enums or records) caused a crash because the base type name was passed to the parser without its required properties (symbols, fields, etc.).Verifying this change
This change added and refactored tests and can be verified as follows:
AvroGenSchemaTests.cs: RenamedNotSupportedSchematoUnknownLogicalTypesFallbackToBaseTypeand updated assertions to verify that both primitive and complex schemas with unknown logical types now result in successful code generation (exit code 0).UnknownLogicalTypeTests.cs: CorrectedTestGetCSharpType_IsFalseto handle reference types (string,byte[]) properly, ensuring tests no longer fail due to the lack of runtime distinction for nullable reference types.LogicalSchema.cscorrectly clones the JSON token and strips thelogicalTypeproperty to allow recursive parsing of complex base schemas without infinite loops.Documentation